<?php
//$a = jgg_test(0,0,1);
echo urlencode("我想你.,;'[]=-0987654321abcdefghijkl");
//print_R($a);

function jgg_test($x,$y,$range){
	(int)$x++;
	(int)$y++;
	$max_number = 100;
	$max_range = 5;
	$row = $col = intval(sqrt($max_number));

	if ($range > $max_range) $range = $max_range;
	if ($range < 0) $range = 0;

	if ($x > $col) $x = $x % $col;
	if ($x < 0) $x = $x % $col + $col;
	
	if ($y > $row) $y = $y % $row;
	if ($y < 0) $y = $y % $row + $row;

	$x_l = ($x - $range) > 0 ? $x - $range : $col + ($x - $range);
	$x_r = ($x + $range) > 0 ? $x + $range : $col + ($x + $range);

	$y_b = ($y - $range) > 0 ? $y - $range : $row + ($y - $range);
	$y_t = ($y + $range) > 0 ? $y + $range : $row + ($y + $range);

	$return_range = array(
		'0'	=> array(
			'x'	=>	--$x_l,
			'y'	=>	--$y_t,
		),
		'1'	=> array(
			'x'	=>	--$x_r,
			'y'	=>	--$y_b,
		),
	);
	return $return_range;
}

?>

